package interfaceGraphique;

import javax.swing.SwingUtilities;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.BoxLayout;

public class AdminGUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JTabbedPane jTabbedPane = null;
	private JMenuBar jJMenuBar = null;
	private JMenu jMenuAide = null;
	private JMenu jMenuFichier = null;
	private JMenuItem jMenuItemQuitter = null;
	private JMenuItem jMenuItemMan = null;
	private JPanel jPanelStatutBar = null;
	public static JLabel jLabelStatus = new JLabel();
	private JProgressBar jProgressBar = null;

	/**
	 * This method initializes jTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	private JTabbedPane getJTabbedPane() {
		if (jTabbedPane == null) {
			jTabbedPane = new JTabbedPane();
			jTabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
			jTabbedPane.addTab("Salle & S�ances de cours", new GestionSalleSeanceGUI());
			jTabbedPane.addTab("Groupes d'Etudiants",new GestionGroupeGUI());
			jTabbedPane.addTab("Enseignants",new GestionEnseignantGUI());
			jTabbedPane.addTab("UE et Type d'Enseignement", new GestionUETEGUI());
			jTabbedPane.addTab("Formation", new GestionFormationGUI());
			jTabbedPane.addTab("Services El�mentaires d'Enseignements", new GestionSEEGUI());
			jTabbedPane.addTab("Ann�es d'Etudes", new GestionAnneesEtudeGUI());
			this.setMinimumSize(new Dimension(jTabbedPane.getMinimumSize().width+10,jTabbedPane.getMinimumSize().height+80));
		}
		return jTabbedPane;
	}

	/**
	 * This method initializes jJMenuBar	
	 * 	
	 * @return javax.swing.JMenuBar	
	 */
	private JMenuBar getJJMenuBar() {
		if (jJMenuBar == null) {
			jJMenuBar = new JMenuBar();
			jJMenuBar.add(getJMenuFichier());
			jJMenuBar.add(getJMenuAide());
		}
		return jJMenuBar;
	}

	/**
	 * This method initializes jMenuAide	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getJMenuAide() {
		if (jMenuAide == null) {
			jMenuAide = new JMenu();
			jMenuAide.setText("Aide");
			jMenuAide.add(getJMenuItemMan());
			jMenuAide.setMnemonic(KeyEvent.VK_A);
		}
		return jMenuAide;
	}

	/**
	 * This method initializes jMenuFichier	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getJMenuFichier() {
		if (jMenuFichier == null) {
			jMenuFichier = new JMenu();
			jMenuFichier.setText("Fichier");
			jMenuFichier.setMnemonic(KeyEvent.VK_F);
			jMenuFichier.add(getJMenuItemQuitter());
		}
		return jMenuFichier;
	}

	/**
	 * This method initializes jMenuItemQuitter	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getJMenuItemQuitter() {
		if (jMenuItemQuitter == null) {
			jMenuItemQuitter = new JMenuItem();
			jMenuItemQuitter.setText("Quitter");
			jMenuItemQuitter.setMnemonic(KeyEvent.VK_Q);
			jMenuItemQuitter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
			jMenuItemQuitter.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					setVisible(false);
					dispose();
				}
			});
			
		}
		return jMenuItemQuitter;
	}

	/**
	 * This method initializes jMenuItemMan	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getJMenuItemMan() {
		if (jMenuItemMan == null) {
			jMenuItemMan = new JMenuItem();
			jMenuItemMan.setText("Manuel Utilisateur");
			jMenuItemMan.setMnemonic(KeyEvent.VK_M);
			jMenuItemMan.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1,0));
		}
		return jMenuItemMan;
	}

	/**
	 * This method initializes jPanelStatutBar	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	public JPanel getJPanelStatutBar() {
		if (jPanelStatutBar == null) {
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.anchor = GridBagConstraints.WEST;
			gridBagConstraints1.weightx = 1.0;
			gridBagConstraints1.insets = new Insets(0, 10, 0, 0);
			gridBagConstraints1.fill = GridBagConstraints.NONE;
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.gridx = 1;
			gridBagConstraints.insets = new Insets(0, 10, 0, 2);
			gridBagConstraints.gridy = 0;
			jLabelStatus = new JLabel();
			jLabelStatus.setText("Statut");
			jPanelStatutBar = new JPanel();
			jPanelStatutBar.setMaximumSize(new Dimension(Integer.MAX_VALUE,0));
			jPanelStatutBar.setBorder(BorderFactory.createLineBorder(Color.BLACK));
			jPanelStatutBar.setLayout(new GridBagLayout());
			jPanelStatutBar.add(jLabelStatus, gridBagConstraints1);
			jPanelStatutBar.add(getJProgressBar(), gridBagConstraints);
		}
		return jPanelStatutBar;
	}

	/**
	 * This method initializes jProgressBar	
	 * 	
	 * @return javax.swing.JProgressBar	
	 */
	public JProgressBar getJProgressBar() {
		if (jProgressBar == null) {
			jProgressBar = new JProgressBar();
			jProgressBar.setPreferredSize(new Dimension(100,12));
		}
		return jProgressBar;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				AdminGUI thisClass = new AdminGUI();
				thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				thisClass.setVisible(true);
			}
		});
	}

	/**
	 * This is the default constructor
	 */
	public AdminGUI() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(800, 600);
		this.setMinimumSize(new Dimension(600,500));
		this.setJMenuBar(getJJMenuBar());
		this.setContentPane(getJContentPane());
		this.setTitle("Section Administrateur");
		this.setResizable(false);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setPreferredSize(new Dimension(800,600));
			jContentPane.setLayout(new BoxLayout(getJContentPane(), BoxLayout.Y_AXIS));
			jContentPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
			jContentPane.add(getJTabbedPane(), null);
			jContentPane.add(getJPanelStatutBar(), null);
		}
		return jContentPane;
	}

}
